import tui from '../../../common/httpRequest'
Page({
  data: {
    bottomPopup: false,
    regionArr: [
      '京',
      '津',
      '沪',
      '渝',
      '蒙',
      '新',
      '藏',
      '宁',
      '桂',
      '港',
      '澳',
      '黑',
      '吉',
      '辽',
      '晋',
      '冀',
      '青',
      '鲁',
      '豫',
      '苏',
      '皖',
      '浙',
      '闽',
      '赣',
      '湘',
      '鄂',
      '粤',
      '琼',
      '甘',
      '陕',
      '黔',
      '滇',
      '川'
    ],
    regionTxt: '粤',
    tabIndex: 26,
    leftDrawer: false,
    rightDrawer: false,
    bottomDrawer: false,
    topDrawer: false,
    mode: 'right'
  },
  showModal: function () {
    this.setData({
      bottomPopup: true
    })
  },
  hideModal: function () {
    this.setData({
      bottomPopup: false
    })
  },
  getRegion: function (e) {
    const index = e.currentTarget.dataset.index;
    let txt = this.data.regionArr[index]
    this.setData({
      regionTxt: txt,
      tabIndex: index,
      bottomPopup: false
    })
    tui.toast('您选择了：' + txt);
  },
  closeDrawer(e) {
    this.setData({
      leftDrawer: false,
      rightDrawer: false,
      bottomDrawer:false,
      topDrawer:false
    })
  },
  rDrawer() {
    this.setData({
      rightDrawer:true
    })
  },
  lDrawer() {
    this.setData({
      leftDrawer:true
    })
  },
  bDrawer() {
    this.setData({
      bottomDrawer:true
    })
  },
  tDrawer() {
    this.setData({
      topDrawer:true
    })
  },
  topPopup(){
    tui.href("/pages/extend/popup/popup")
  }
})